package com.wen.yygh.hosp.controller;

import com.wen.yygh.common.result.Result;
import com.wen.yygh.hosp.service.ScheduleService;
import com.wen.yygh.model.hosp.Schedule;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/admin/hosp/Schedule")

@Api(tags = "排版信息")
public class ScheduleController {
    @Autowired
    private ScheduleService scheduleService;


    @ApiOperation(value = "查询排班规则数据")
    @GetMapping("getRuleSchedule/{pageNum}/{pageSize}/{hoscode}/{depcode}")
    public Result getScheduleRule(@PathVariable("pageNum") Long pageNum,
                                  @PathVariable("pageSize") Long pageSize,
                                  @PathVariable("hoscode") String hoscode,
                                  @PathVariable("depcode") String depcode) {
        Map<String, Object> result = scheduleService.getScheduleRuleByHoscodeAndDepcode(pageNum, pageSize, hoscode, depcode);
        return Result.ok(result);
    }

    /**
     * 获取排班详情
     *
     * @param hoscode
     * @param depcode
     * @param workDate
     * @return
     */

    @GetMapping("getDetailSchedule/{hoscode}/{depcode}/{workDate}")
    @ApiOperation(value = "查询排班详细信息")
    public Result getDetailSchedule(@PathVariable("hoscode") String hoscode,
                                    @PathVariable("depcode") String depcode,
                                    @PathVariable("workDate") String workDate) {
        List<Schedule> scheduleList = scheduleService.getDetailSchedule(hoscode, depcode, workDate);
        return Result.ok(scheduleList);
    }
}
